unit uFrmModeloCadastro;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dxSkinsCore, dxSkinsdxBarPainter, dxSkinBlack, dxSkinBlue,
  dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy,
  dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
  dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, dxSkinPumpkin, dxSkinSeven, dxSkinSharp, dxSkinSilver,
  dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinsDefaultPainters,
  dxSkinValentine, dxSkinXmas2008Blue, cxClasses, dxBar, ActnList, ExtCtrls,
  cxGraphics, cxLookAndFeels, cxLookAndFeelPainters, Menus, StdCtrls,
  cxButtons, uCadControl, DB, DBClient, DBActns;

type
  TfrmModeloCadastro = class(TForm)
    aclComandos: TActionList;
    panComandos: TPanel;
    btnConfirma: TcxButton;
    cdsBase: TClientDataSet;
    dsBase: TDataSource;
    cxButton1: TcxButton;
    acConfirmar: TAction;
    acCancelar: TAction;
    procedure acCancelarExecute(Sender: TObject);
    procedure acConfirmarExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
    CadControl: TCadControl;
    constructor Create(AOwner: TComponent; Cds : TClientDataSet;
        MasterField : TField); overload;
  end;

var
  frmModeloCadastro: TfrmModeloCadastro;

implementation

uses uDmMain, uDmGermax, uDmNf;
{$R *.dfm}
{ TfrmModeloCadastro }

procedure TfrmModeloCadastro.acCancelarExecute(Sender: TObject);
begin
  dsBase.DataSet.Cancel;
  close;
end;

procedure TfrmModeloCadastro.acConfirmarExecute(Sender: TObject);
begin
  dsBase.DataSet.Post;
  close;
end;

constructor TfrmModeloCadastro.Create(AOwner: TComponent;
    Cds : TClientDataSet; MasterField : TField);
begin
  Create(AOwner);
  CadControl:=TCadControl.Create(Cds,MasterField,dmNF.NfConn);
end;


procedure TfrmModeloCadastro.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if dsBase.DataSet.State in [dsEdit, dsInsert] then
    Action:=caNone;
end;

end.
